#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define sz(s) int(s.size())
typedef long long ll;

const int N = 2e5 + 10;
const ll mod = 1e9 + 7; 
int l, r;

void solve()
{
	cin >> l >> r;
	cout << __lg(r) << endl;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(nullptr);
	int T = 1;
	cin >> T;
	while(T --) solve();
	return 0;
}
